import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getUserAPI } from '@/api/user.js'
export const useUserStore = defineStore(
  'user',
  () => {
    const userInfo = ref({})
    const getUser = async (account, password) => {
      const res = await getUserAPI(account, password)
      userInfo.value = res.data.result
      console.log(userInfo.value)
    }
    const clearUser = () => {
      userInfo.value = {}
    }
    return { userInfo, getUser, clearUser }
  },
  { persist: true }
)
